package com.app.Tree;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;

public class CirleButton {

	private boolean expand=true;
	private float x, y;
	public static float r=3;
	public static float space=10;
	public CirleButton(float x, float y){
		this.x=x;
		this.y=y;
		this.r=r;
		expand=true;
	}

	public void onDraw(Canvas canvas, Paint paint) {

		Paint p = new Paint(paint);

		if (expand) {

			p.setStyle(Style.STROKE);
		} else {
			p.setStyle(Style.FILL_AND_STROKE);

		}
		canvas.drawCircle(x, y, r, p);
	}
	public void setPosition(float x, float y){
		this.x=x;
		this.y=y;
	}
	public boolean isCollision(float x, float y){
//		float dx,dy;
//		dx=this.x-x;
//		dy=this.y-y;
//		return r*r>(dx*dx+dy*dy);
		return (x>this.x-(r+this.space)&&x<this.x+(r+this.space) && y>this.y-(r+this.space) && y<this.y+(r+this.space));
	}
	public boolean isExpand() {
		return expand;
	}
	public void setExpand(boolean expand) {
		this.expand = expand;
	}
	public float getX() {
		return x;
	}
	public void setX(float x) {
		this.x = x;
	}
	public float getY() {
		return y;
	}
	public void setY(float y) {
		this.y = y;
	}
	public float getR() {
		return r;
	}
	public void setR(float r) {
		this.r = r;
	}
	
	
}
